package com.twu.biblioteca;

import java.io.IOException;

public class BibliotecaApp {

    private DisplayMessage displayMessage;
    private BookCatalog bookCatalog;
    private MainMenu mainMenu;
    private UserInputReader userInputReader;
    private MovieCatalog movieCatalog;
    private UsersRepository usersRepository;

    public static void main(String[] args) throws IOException {
        BibliotecaApp app = new BibliotecaApp();
        app.setDisplayMessage(new DisplayMessage());
        app.setBookCatalog(new BookCatalog());
        app.setMovieCatalog(new MovieCatalog(new DisplayMessage()));
        app.setMainMenu(new MainMenu(app.getBookCatalog(), app.getMovieCatalog(), app.displayMessage, new UserInputReader(), new UserSession(),new  UsersRepository()));
        app.start();
    }

    //setters
    public void setDisplayMessage(DisplayMessage displayMessage) {
        this.displayMessage = displayMessage;
    }

    public void setMainMenu(MainMenu mainMenu){
         this.mainMenu = mainMenu;
    }

    public void setBookCatalog(BookCatalog bookCatalog){
        this.bookCatalog = bookCatalog;
    }

    public void setMovieCatalog(MovieCatalog movieCatalog){
        this.movieCatalog = movieCatalog;
    }

    //getters
    public DisplayMessage getDisplayMessage() {
        return displayMessage;
    }

    public MainMenu getMainMenu(){
        return mainMenu;
    }

    public BookCatalog getBookCatalog(){
        return bookCatalog;
    }

    public void start() throws IOException {
        displayMessage.showWelcomeMessage();
        mainMenu.displayMainMenu();
    }

    public MovieCatalog getMovieCatalog() {
        return movieCatalog;
    }
}
